import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

public class Test {
    public static void main1(String[] args) {
        ArrayList mylist = new ArrayList<>();
        mylist.add(1);
        mylist.add(2);
        mylist.add(3);
        mylist.add(2,33);
        System.out.println(mylist);
        mylist.remove(2);
        System.out.println(mylist);
        List<Integer> list1 = new ArrayList<>();
        list1.add(11);
        list1.add(12);
        System.out.println(list1);
        list1 = mylist.subList(1,2);
        System.out.println(list1);
        Iterator<Integer> it = list1.iterator();
        while (it.hasNext()) {
            System.out.println(it.next()+" ");
        }
    }
    class Solution {
        public List<List<Integer>> generate(int numRows) {
            List<List<Integer>> ret = new ArrayList<>();
            List<Integer> list = new ArrayList<>();
            list.add(1);
            ret.add(list);
            for (int i = 1;i < numRows;i++) {
                List<Integer> curRow = new ArrayList<>();
                curRow.add(1);
                List<Integer> preRow = ret.get(i-1);
                for (int j = 1;j < i;j++) {
                    int val = preRow.get(j) +preRow.get(j-1);
                    curRow.add(1);
                }
                curRow.add(1);
            }
            return ret;
        }
    }
}
